package com.devo.icecream.utils

fun plcIdToBucketId(id: Int):String {
    return when {
        id <= 14 -> {
            "C${id}"
        }
        id <= 20 -> {
            "D${id - 14}"
        }
        else -> {
            "P${id - 20}"
        }
    }
}

//按照规则将桶位的ID转换成PLC_ID
fun bucketIdToPlcId(code:String):Int{
    return  when {
        code.startsWith("C") -> {
            code.substring(1).toInt()
        }
        code.startsWith("D") -> {
            code.substring(1).toInt() + 14
        }
        code.startsWith("P") -> {
            code.substring(1).toInt() + 20
        }
        else -> -1
    }
}
